package com.itheima.dbservice;

import com.itheima.bean.CodeBean;
import com.itheima.pojo.User;
import com.itheima.vo.HuanXinInfoVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class HuanXinService {
    @DubboReference
    private UserService userService;
    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    public HuanXinInfoVo getHuanXinInfo() {
        String uid = stringRedisTemplate.opsForValue().get(CodeBean.ID);
        User user = userService.getUser(uid);

        HuanXinInfoVo huanXinInfoVo = new HuanXinInfoVo();
        huanXinInfoVo.setUsername(user.getHxUser());
        huanXinInfoVo.setPassword(user.getHxPassword());
        return huanXinInfoVo;
    }
}
